import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;


public class MouseClick implements MouseListener {
	
	ControlPanel control;
	RobotPanel robot;
	ButtonListener bl;
	
	MouseClick(RobotPanel rob, ControlPanel con, ButtonListener b){
		control = con;
		robot = rob;
		bl=b;
	}
	
	@Override
	public void mouseClicked(MouseEvent e) {
		if(control.add_light){
			int intensity = Integer.parseInt(bl.getIntesity().getText());
			robot.addLight(new Light(e.getX(),e.getY(), intensity));
			robot.repaint();
		}
		if(control.add_robot)
		{
		      int x = e.getX();
		      int y = e.getY();
		      int k1 = Integer.parseInt(bl.getK1Matrix().getText());
		      int k2 = Integer.parseInt(bl.getK2Matrix().getText());
		      int k3 = Integer.parseInt(bl.getK3Matrix().getText());
		      int k4 = Integer.parseInt(bl.getK4Matrix().getText());
		      Robot rob = new Robot(x, y, k1, k2, k3, k4);
			robot.addRobot(rob);
			robot.repaint();
		}
		
	}

	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseReleased(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseEntered(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseExited(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}

}
